package com.future.service.impl;

import com.future.mapper.AdminMapper;
import com.future.pojo.Album;
import com.future.pojo.Discuss;
import com.future.pojo.Musics;
import com.future.pojo.Users;
import com.future.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    //查询所有用户
    @Override
    public List<Users> queryAllUsers(int begin,int end) {
        return adminMapper.queryAllUsers(begin,end);
    }


    //查询所有管理员
    @Override
    public List<Users> queryAdmin() {
        return adminMapper.queryAdmin();
    }

    //查询所有歌手
    @Override
    public List<Users> querySinger(int begin,int end) {
        return adminMapper.querySinger(begin,end);
    }

    //增加歌手
    @Override
    public int addSinger(String userName, String userGen,String userHao, String userPwd, String userEmail, String userBirth, String userHot, String userImgload,String userThing,String userLv) {
        int nums = adminMapper.addSinger(userName,userGen,userHao,userPwd,userEmail,userBirth,userHot,userImgload,userThing,userLv);
        return nums;
    }

    //管理员更新用户信息
    @Override
    public int updateSinger(Integer userId,String userName, String userGen, String userPwd,String userBirth, String userHot, String userImgload,String userThing) {
        int num = adminMapper.updateSinger(userId,userName,userGen,userPwd,userBirth,userHot,userImgload,userThing);
        return num;
    }
    //删除一个用户
    @Override
    public int deleteUser(Integer userId) {
        return adminMapper.deleteUser(userId);
    }


    //模糊查询一个用户（用户名）
    @Override
    public List queryUserByusername(String userName) {
        return adminMapper.queryUserByusername(userName);
    }

    //模糊查询一个歌手（用户名）
    @Override
    public List querySingerByusername(String userName) {
        return adminMapper.querySingerByusername(userName);
    }

    @Override
    public List querySongBymcName(String mcName) {
        return adminMapper.querySongBymcName(mcName);
    }
    //根据id查找用户
    @Override
    public Users queryByIdUser(int userId) {
        return adminMapper.queryByIdUser(userId);
    }


    //管理员更新用户信息
    @Override
    public int updateUser(Integer userId, String userName, String userEmail, String userLv, Integer userVipBal,String userGen) {
        return adminMapper.updateUser(userId,userName,userEmail,userLv,userVipBal,userGen);
    }

    //添加用户
    @Override
    public int adduser(String userName,String userHao,String userPwd,String userEmail,String userGen) {
        return adminMapper.adduser(userName, userHao,userPwd,userEmail,userGen);
    }


    @Override
    public List<Discuss> queryDis() {
        return adminMapper.queryDis();
    }

    //查询所有歌曲
    @Override
    public List<Musics> queryAllMusic(int begin,int end) {
        return adminMapper.queryAllMusic(begin,end);
    }

    //删除歌曲
    @Override
    public int deleteSong(Integer mcId) {
        int num = adminMapper.deleteSong(mcId);
        return num;
    }

    //添加歌曲
    @Override
    public int addSong(String mcName, int mcHot, int mcLv, String mcMvLoad, String mcLoad, String mcTime, String albName, String userName, String mcLrc, int albId,String mcLoaddele) {
        int num = adminMapper.addSong(mcName,mcHot,mcLv,mcMvLoad,mcLoad,mcTime,albName,userName,mcLrc,albId,mcLoaddele);
        return num;
    }

    //修改歌曲
    @Override
    public int updateSong(Integer mcId,String mcName, int mcHot, int mcLv, String albName, String userName, String mcLrc, int albId) {
        int num = adminMapper.updateSong(mcId,mcName,mcHot,mcLv,albName,userName,mcLrc,albId);
        return num;
    }
    //检查歌曲是否存在
    @Override
    public int checkSong(String mcName, String userName) {
        int num = adminMapper.checkSong(mcName,userName);
        return num;
    }

    @Override
    public int userCount() {
        int num = adminMapper.userCount();
        return num;
    }

    @Override
    public int musicCount() {
        int num = adminMapper.musicCount();
        return num;
    }
    @Override
    public int singerCount() {
        int num = adminMapper.singerCount();
        return num;
    }

    @Override
    public List<Album> queryAllAlbum(int begin, int end) {
        List<Album> queryAllAlbunm = adminMapper.queryAllAlbum(begin,end);
        return queryAllAlbunm;
    }

    @Override
    public int deleteAlbum(int albId) {
        int num = deleteAlbum(albId);
        return num;
    }

    @Override
    public int deletesong(int albId) {
        int num = deletesong(albId);
        return num;
    }

    @Override
    public int BatchdeleteUsers(List<String> numbers) {
        int num = adminMapper.BatchdeleteUsers(numbers);
        return num;
    }


    //同意成为歌手
    @Override
    public int changeSingerTrue(int userId, String userLv) {
        return adminMapper.changeSingerTrue(userId, userLv);
    }

    //不同意成为歌手
    @Override
    public int changeSingerFalse(int userId, String userLv) {
        return adminMapper.changeSingerFalse(userId, userLv);
    }

    @Override
    public int albumCount() {
        int num = adminMapper.albumCount();
        return num;
    }

    @Override
    public List<Album> queryalbumByusername(String albName) {
        List<Album> list = adminMapper.queryalbumByusername(albName);
        return list;
    }

    @Override
    public int checkAlbum(String albName) {
        int num = adminMapper.checkAlbum(albName);
        return num;
    }

    @Override
    public int addAlbum(String albName, String albThing, int userId, int albHot, String albImgload, String albTime, String albLanguage,String albType) {
        int num = adminMapper.addAlbum(albName,albThing,userId,albHot,albImgload,albTime,albLanguage,albType);
        return num;
    }

    @Override
    public int updateAlbum(String albName, String albThing, int albHot, String albImgload, String albTime, String albLanguage,int albId,String albType) {
        int num = adminMapper.updateAlbum(albName,albThing,albHot,albImgload,albTime,albLanguage,albId,albType);
        return num;
    }

//   删除评论

    @Override
    public int deleteDis(int disId) {
        int num = adminMapper.deleteDis(disId);
        return num;
    }

    @Override
    public int BatchdeleteSongs(List<String> names) {
        int num = adminMapper.BatchdeleteSongs(names);
        return num;
    }

    @Override
    public int BatchdeleteAlbum(List<String> numbers) {
        int num = adminMapper.BatchdeleteAlbum(numbers);
        return num;
    }
}
